/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webserver;

import java.util.TimerTask;

/**
 * CacheInvalidator class checks the whole Cache for invalid entries
 * The execution of this is scheduled periodically
 * 
 */
public class CacheInvalidator extends TimerTask {

	// Variables
	private Cache cache;

	/**
	 * CacheInvalidator Default Constructor
	 */
	public CacheInvalidator() {
		cache = Cache.getInstance();
	}

	/**
	 * The run Method will invalidate the Cache Items which need to be
	 */
	@Override
	public void run() {
		try {
			this.cache.checkForInvalidEntries();
		} catch (RuntimeException r) {
			Logger.writeToLog("InvalidateCache: " + r.toString());
		}
	}
}
